<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
class Index extends Controller
{
    public function index()
    {
        $base=Db::name("base")->select();
        $this->assign("base",$base);
        $bases=Db::query('select * from type t,base b where t.tid=b.tid order by b.bid desc');
        $this->assign("base",$bases);
        $clean=Db::name("clean")->select();
        $this->assign("clean",$clean);
        $cleans=Db::query('select * from type t,clean c where t.tid=c.tid order by c.clid desc');
        $this->assign("clean",$cleans);
        $eye=Db::name("eye")->select();
        $this->assign("eye",$eye);
        $eyes=Db::query('select * from type t,eye e where t.tid=e.tid order by e.eid desc');
        $this->assign("eye",$eyes);
        $face=Db::name("face")->select();
        $this->assign("face",$face);
        $faces=Db::query('select * from type t,face f where t.tid=f.tid order by f.fid desc');
        $this->assign("face",$faces);
        $lipstick=Db::name("lipstick")->select();
        $this->assign("lipstick",$lipstick);
        $lipsticks=Db::query('select * from type t,lipstick l where t.tid=l.tid order by l.lid desc');
        $this->assign("lipstick",$lipsticks);
        $mask=Db::name("mask")->select();
        $this->assign("mask",$mask);
        $masks=Db::query('select * from type t,mask m where t.tid=m.tid order by m.mid desc');
        $this->assign("mask",$masks);
        $perfume=Db::name("perfume")->select();
        $this->assign("perfume",$perfume);
        $perfumes=Db::query('select * from type t,perfume p where t.tid=p.tid order by p.pid desc');
        $this->assign("perfume",$perfumes);
        $skin=Db::name("skin")->select();
        $this->assign("skin",$skin);
        $skins=Db::query('select * from type t,skin s where t.tid=s.tid order by s.sid desc');
        $this->assign("skin",$skins);
        $sun=Db::name("sun")->select();
        $this->assign("sun",$sun);
        $suns=Db::query('select * from type t,sun s where t.tid=s.tid order by s.sunid desc');
        $this->assign("sun",$suns);
        $types=Db::name("type")->select();
        $this->assign("types",$types);
        return $this->fetch();
    }
    /**
     * 制作二维码图片
     * @return [type] [description]
     */
    public function qrcode() {
        //加载第三方类库
        vendor('phpqrcode.phpqrcode');
        $url="http://www.baidu.com";
        $size=2;    //图片大小
        $errorCorrectionLevel = "Q"; // 容错级别：L、M、Q、H
        $matrixPointSize = "8"; // 点的大小：1到10
        //实例化
        $qr = new \QRcode();

        //会清除缓冲区的内容，并将缓冲区关闭，但不会输出内容。
        ob_end_clean();
        //输入二维码
        $qr::png($url, false, $errorCorrectionLevel, $matrixPointSize);

    }
}
